/**
 * Created by liyang on 2017/10/28.
 */
import React,{Component} from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Image,
    Button,
    FlatList
} from 'react-native';

export default class ServeList extends Component {

    constructor(props) {
        super(props);
        this.state={
            dataArray: [1,2]
        }

    }
    _renderItem = ()=>(
        <ListIiem1>

        </ListIiem1>
    );
    render() {
        return (
            <FlatList
                data = {this.state.dataArray}
                renderItem = {this._renderItem}
            />
        )
    }
}

class ListIiem1 extends Component {
    constructor(props) {
        super(props);
        this.state={
            children: []
        };
        for (var i=0; i < 4;i++) {
            var view = <View key={i} style={{flex: 1, alignItems:'center'}}>
                <Image
                    style={{width: 20,height: 20}}
                    source={require('./../image/chat.png')}
                />
                <Text>{'kanakn'}</Text>
            </View>;


            this.state.children.push(view)
        }

    }

    render() {
        return (
            <View style={{flexDirection: 'row'}}>
                {this.state.children}
            </View>
        )
    }
}